package com.xh.xyzp.controller;

import com.xh.xyzp.common.domain.vo.resp.ApiResult;
import com.xh.xyzp.common.domain.vo.resp.PageResp;
import com.xh.xyzp.domain.entity.Job;
import com.xh.xyzp.domain.vo.JobPageReq;
import com.xh.xyzp.domain.vo.JobResp;
import com.xh.xyzp.domain.vo.JobSubmitReq;
import com.xh.xyzp.service.JobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: xianghao
 * @Description:
 * @Date: 2025-04-12  13:46
 */
@Api(tags = "职位接口")
@RestController
@RequestMapping("/job")
public class JobController {

    @Autowired
    private JobService jobService;


    @ApiOperation("详细信息")
    @PostMapping("/info/{jobId}")
    public ApiResult<Job> getInfo(@PathVariable("jobId") Long jobId) {
        return ApiResult.success(jobService.getInfo(jobId));
    }


    @ApiOperation("新增/编辑")
    @PostMapping("/submit")
    public ApiResult<Void> submit(@RequestBody JobSubmitReq req) {
        jobService.submit(req);
        return ApiResult.success();
    }

    @ApiOperation("列表")
    @PostMapping("/list")
    public ApiResult<PageResp<JobResp>> getList(@RequestBody JobPageReq req) {
        return ApiResult.success(jobService.getList(req));
    }

    @ApiOperation("列表")
    @PostMapping("/admin/list")
    public ApiResult<PageResp<JobResp>> getAdminList(@RequestBody JobPageReq req) {
        return ApiResult.success(jobService.getAdminList(req));
    }


    @ApiOperation("类型列表")
    @PostMapping("/type/list")
    public ApiResult<List<String>> getTypeList(@RequestBody JobPageReq req) {
        return ApiResult.success(jobService.getTypeList(req));
    }



}
